<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>进度条 - 组件演示</title>
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../components/progress/progress.css">
</head>
<body>
    <div class="container">
        <header class="header">
            <h1>🚀 openHarmony_Cordova_NutpiDesign</h1>
            <p class="subtitle">组件演示 - 进度条</p>
        </header>

        <nav class="demo-nav">
            <a href="../index.html" class="nav-back">← 返回首页</a>
        </nav>

        <main class="main-content">
            <section class="demo-section">
                <h2>📊 进度条演示</h2>
                
                <div class="demo-container">
                    <div class="demo-item">
                        <h3>线性进度条</h3>
                        <div id="lineProgress"></div>
                        <button class="btn btn-primary" onclick="updateLineProgress()" style="margin-top: 12px; width: 100%;">更新进度</button>
                    </div>

                    <div class="demo-item">
                        <h3>不同状态</h3>
                        <div style="display: flex; flex-direction: column; gap: 16px;">
                            <div id="normalProgress"></div>
                            <div id="successProgress"></div>
                            <div id="warningProgress"></div>
                            <div id="errorProgress"></div>
                        </div>
                    </div>

                    <div class="demo-item">
                        <h3>圆形进度条</h3>
                        <div style="display: flex; gap: 20px; justify-content: center; flex-wrap: wrap;">
                            <div id="circleProgress1"></div>
                            <div id="circleProgress2"></div>
                            <div id="circleProgress3"></div>
                        </div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>水平步骤条</h3>
                        <div id="horizontalSteps"></div>
                        <div style="margin-top: 16px; display: flex; gap: 8px;">
                            <button class="btn btn-secondary" onclick="stepsPrev()">上一步</button>
                            <button class="btn btn-primary" onclick="stepsNext()">下一步</button>
                        </div>
                    </div>

                    <div class="demo-item" style="grid-column: 1 / -1;">
                        <h3>垂直步骤条</h3>
                        <div id="verticalSteps"></div>
                    </div>
                </div>
            </section>

            <section class="demo-section">
                <h2>使用代码</h2>
                <pre><code>// 1. 引入文件
&lt;link rel="stylesheet" href="components/progress/progress.css"&gt;
&lt;script src="components/progress/progress.js"&lt;/script&gt;

// 2. 创建容器
&lt;div id="progressContainer"&lt;/div&gt;

// 3. 初始化进度条
const progress = new Progress({
    container: '#progressContainer',
    type: 'line',
    percent: 65,
    status: 'normal'
});

// 4. 更新进度
progress.setPercent(80);

// 5. 设置状态
progress.setStatus('success');</code></pre>
            </section>
        </main>

        <footer class="footer">
            <p>&copy; 2025 OpenHarmony 三方库适配中心 | MIT License</p>
        </footer>
    </div>

    <script src="../components/progress/progress.js"></script>
    <script>
        // 线性进度条
        const lineProgress = new Progress({
            container: '#lineProgress',
            type: 'line',
            percent: 65,
            status: 'normal'
        });

        function updateLineProgress() {
            const newPercent = Math.floor(Math.random() * 100);
            lineProgress.setPercent(newPercent);
        }

        // 不同状态
        new Progress({
            container: '#normalProgress',
            type: 'line',
            percent: 50,
            status: 'normal'
        });

        new Progress({
            container: '#successProgress',
            type: 'line',
            percent: 100,
            status: 'success'
        });

        new Progress({
            container: '#warningProgress',
            type: 'line',
            percent: 75,
            status: 'warning'
        });

        new Progress({
            container: '#errorProgress',
            type: 'line',
            percent: 30,
            status: 'error'
        });

        // 圆形进度条
        new Progress({
            container: '#circleProgress1',
            type: 'circle',
            percent: 45,
            status: 'normal'
        });

        new Progress({
            container: '#circleProgress2',
            type: 'circle',
            percent: 75,
            status: 'success'
        });

        new Progress({
            container: '#circleProgress3',
            type: 'circle',
            percent: 100,
            status: 'success'
        });

        // 水平步骤条
        const horizontalSteps = new Steps({
            container: '#horizontalSteps',
            steps: [
                { title: '第一步', description: '填写信息' },
                { title: '第二步', description: '确认信息' },
                { title: '第三步', description: '完成' }
            ],
            current: 1,
            direction: 'horizontal'
        });

        function stepsNext() {
            horizontalSteps.next();
        }

        function stepsPrev() {
            horizontalSteps.prev();
        }

        // 垂直步骤条
        new Steps({
            container: '#verticalSteps',
            steps: [
                { title: '第一步', description: '提交申请' },
                { title: '第二步', description: '审核中' },
                { title: '第三步', description: '已批准' }
            ],
            current: 1,
            direction: 'vertical'
        });
    </script>

    <style>
        .demo-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
            gap: 20px;
            margin-bottom: 20px;
        }

        .demo-item {
            background: var(--bg-light);
            padding: 16px;
            border-radius: 8px;
            overflow: visible;
            position: relative;
        }

        .demo-item h3 {
            margin-top: 0;
            margin-bottom: 16px;
            font-size: 16px;
            color: var(--text-primary);
        }

        .demo-item > div {
            margin-bottom: 12px;
            overflow: visible;
        }

        .btn {
            padding: 10px 16px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            transition: var(--transition);
        }

        .btn-primary {
            background: var(--primary-color);
            color: white;
        }

        .btn-primary:hover {
            opacity: 0.9;
        }

        .btn-secondary {
            background: var(--bg-white);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

        .btn-secondary:hover {
            border-color: var(--primary-color);
            color: var(--primary-color);
        }

        @media (max-width: 768px) {
            .demo-container {
                grid-template-columns: 1fr;
            }
        }
    </style>
</body>
</html>
